function resolveData(data) {
    let arr = [];
    for (let k in data) {
        arr.push(k + '=' + data[k])
    }
    return arr.join('&');
}
//返回
function Ajaxback(option) {
    let xhr = new XMLHttpRequest();
    let qs = resolveData(option.data);
    if (option.method && option.method.toUpperCase() === 'GET' || option.type && option.type.toUpperCase() === 'GET') {
        xhr.open('GET', (option.url + '?' + qs) || (option.URL + '?' + qs))
        xhr.send()
    } else if (option.method && option.method.toUpperCase() === 'POST' || option.type && option.type.toUpperCase() === 'POST') {
        xhr.open('POST', option.url || option.URL)
        xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded')
        xhr.send(qs);
    }

    xhr.onreadystatechange = () => {
        if (xhr.status == 200 && xhr.readyState === 4) {
            let result = JSON.parse(xhr.responseText);
            option.success(result);
        }
    }

}